PATHMac OS 8 Developer Documentation > Operating System Services > Multiprocessing Services >

Adding Multitasking Capability to Applications Using Multiprocessing Services

   

MPRemoteCall

Calls a nonreentrant function and blocks the current task.

void *MPRemoteCall (
                     MPRemoteProcedure remoteProc,
                     void *parameter,
                     MPRemoteContext context);
remoteProc
A pointer of type MPRemoteProcedure that references the application-defined function you want to call. See MyRemoteProcedure for more information about the form of this function.
parameter
A pointer to a parameter to pass to the application-defined function. For example, this value could point to a data structure or a memory location.
context
A value of type MPRemoteContext that specifies which contexts (that is processes) are allowed to execute the function. See Remote Call Context Option Constants for a list of possible values.
DISCUSSION

You use this function primarily to indirectly execute Mac OS system software functions. The task making the remote call is blocked until the call completes. The amount of time taken to schedule the remote procedure depends on the choice of the designated operating context. Specifying kMPAnyRemoteContext offers the lowest latency, but the called procedure may not have access to process-specific resources such as some low-memory values. Specifying kMPOwningProcessRemoteContext has higher latency because the remote procedure is deferred until the owning process becomes active. However, the remote procedure is guaranteed to execute within the owning process.

Note that with the exception of functions in Multiprocessing Services, you cannot safely call any system software functions directly from a preemptive task. Even if some system software function appears to work today when called from a preemptive task, unless explicitly stated otherwise there is no guarantee that subsequent versions of the same function will continue to work in future versions of system software. In Mac OS 8 implementations of Multiprocessing Services, the only exceptions to this rule are the atomic memory operations (such as AddAtomic ) exported in the InterfaceLib shared library. Even these functions may switch to 68K mode if the operands to them are not aligned. If you need to access system software functions from a preemptive task, you must do so using the MPRemoteCall function.

VERSION NOTES

Introduced with Multiprocessing Services 2.0.


© 1999 Apple Computer, Inc. – (Last Updated 07 May 99)